<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组添加元素</title>
</head>
<body>
    <script>
        let arr1 = ['rkejg','jbvd','difjgvoi'];
        let arr2 = [345,647,787,9087];

        // 方法一
        // arr1[arr1.length] = 'hsjdagf74586y4827';
        // console.log(arr1);

        // 方法二
        // console.log([...arr1,...arr2]);

        // 方法三
        let length = arr1.push('5635',...arr2);
        console.log(length);
        console.log(arr1);



        function rangeArr(begin,end){
            const arr = [];
            for (let i = begin; i <= end; i++){
                arr.push(i);
            };
            return arr;
        }
        console.log(rangeArr(1,5));
    </script>
</body>
</html>